<?php

Route::group(['middleware' => ['web'], 'namespace' => 'Modules\Buy\Http\Controllers'], function()
{
//前台首页
    Route::get('/', 'HomeController@index');
//前台登录页
    Route::get('/deng','LoginController@login')->name('deng');
//前台注册页
    Route::get('/zhu','RegisterController@zhu')->name('zhu');
//配置加载邮箱注册验证页:
    Route::any('/jia','RegisterController@jia')->name('jia');
//    配置激活邮箱路由
    Route::get("/jihuo/{token}",'RegisterController@jihuo')->name("jihuo");
//    配置短信验证的路由
    Route::any('/duanxin','RegisterController@duanxin')->name('duanxin');
//    登录页面
    Route::any('/lu','LoginController@lu')->name('lu');
//    忘记密码路由
    Route::get('/forget','ForgetController@forget')->name('forget');
//    忘记密码发邮件的路由
    Route::any('/you','ForgetController@you')->name('you');
//配置修改密码的模板路由
    Route::get("/gaimima/{email}","ForgetController@gaimima")->name("gaimima");
//    修改好密码之后的表单提交路由
    Route::any('/changemima','ForgetController@changemima')->name('changemima');
//    配置登录退出路由
    Route::get('/tuichu','LoginController@tuichu')->name('tuichu');


//    配置商品详情页路由
    Route::any('/detail/{good}/{shuxing?}','HomeController@detail')->name('detail');
//    配置商品列表页,属性按参数形式传过去
    Route::any('/list/{cid}/{attrids?}/{brandid?}','HomeController@list')->name('list');


});



//微信的消息通知一定不能放到路由里
Route::any('/notify','Modules\Buy\Http\Controllers\CardController@notify');
//搜索路由
Route::any('/search/','Modules\Buy\Http\Controllers\HomeController@search')->name('search');

Route::group(['middleware' => ['web','auth:shop'], 'namespace' => 'Modules\Buy\Http\Controllers'], function()
{
//    配置个人中心首页路由
Route::get('/people','PeopleController@index')->name('people');
//    个人信息路由
Route::get('/userinfo','PeopleController@userinfo')->name('userinfo');
//    修改个人信息表单提交路由
Route::post('/changeinfo','PeopleController@changeinfo')->name('changeinfo');
//安全设置页面路由
    Route::get('/security','PeopleController@security')->name('security');
//   修改密码路由
    Route::get('/mima','PeopleController@mima')->name('mima');
//    修改密码表单提交路由
    Route::post('/xiumima','PeopleController@xiumima')->name('xiumima');
//    配置邮箱页面路由
    Route::get('/fayoujian','PeopleController@fayoujian')->name('fayoujian');
//    配置获取验证码路由
    Route::any('/yzm','PeopleController@yzm')->name('yzm');
//    配置换绑表单提交页
    Route::any('/huanbang','PeopleController@huanbang')->name('huanbang');
//    实名认证
    Route::get('/idcard','PeopleController@idcard')->name('idcard');
//    实名认证提交路由
    Route::post('/shiming','PeopleController@shiming')->name('shiming');
//    安全认证
    Route::get('/safe','PeopleController@safe')->name('safe');
//    安全认证表单提交路由
    Route::post('/safeyz','PeopleController@safeyz')->name('safeyz');


//    地址管理
    Route::get('/adress','PeopleController@adress')->name('adress');
//    配置ajax改变默认地址的方法
    Route::get('/moren/{id}','PeopleController@moren')->name('moren');
//    新地址
    Route::any('/newadress','PeopleController@newadress')->name('newadress');
//    配置编辑页面路由
    Route::get('/bianji/{id}','PeopleController@bianji')->name('bianji');
//    配置表单提交路由
    Route::post('/edit','PeopleController@edit')->name('edit');

//    配置删除路由
    Route::get('/dell/{id}','PeopleController@del')->name('dell');

//    收藏路由
    Route::get('/cang','PeopleController@cang')->name('cang');


//    配置收藏路由
    Route::get('/shoucang/{goodid}','CardController@shoucang')->name('shoucang');
//    配置足迹路由
    Route::get('/foot','PeopleController@foot')->name('foot');
//    配置添加到足迹路由
    Route::any('/zuji/{goodid}','PeopleController@zuji')->name('zuji');
//    删除足迹
    Route::any('/chu/{id}','PeopleController@chu')->name('chu');
//    取消收藏
    Route::any('/cangqu/{id}','PeopleController@cangqu')->name('cangqu');

//    配置购物车ajax路由
    Route::get('/card','CardController@index')->name('card');
//    购物车ajax请求方法
    Route::any('/addcard','CardController@addcard')->name('addcard');
//    购物车ajax请求删除
    Route::get('/del/{id}','CardController@del')->name('del');


//    配置订单路由
    Route::get('/order','CardController@order')->name('order');
//    提交订单路由
    Route:: post('/suborder','CardController@suborder')->name('suborder');
//    支付页面路由
    Route::get('/pay/{orderId}','CardController@pay')->name('pay');
    //检测是否支付路由
    Route::get('/checkStatus/{orderId}','CardController@checkStatus');
//    支付成功跳的页面
    Route::any('/success/{orderId}','CardController@success')->name('success');

//    订单列表页面
   Route::get('/orderlist','CardController@orderlist')->name('orderlist');
//   删除订单ajax路由
    Route::get('/shanchu/{orderId}','CardController@shanchu')->name('shanchu');
//    取消订单路由
    Route::get('/quxiao/{orderId}','CardController@quxiao')->name('quxiao');

});


Route::group(['middleware' => ['web','auth:admin'], 'prefix' => 'buy', 'namespace' => 'Modules\Buy\Http\Controllers'], function()
{

    Route::get('/', 'BuyController@index')->name('buy');
});
//arr-route
Route::group(['middleware' => ['web','auth:admin'],'prefix'=>'buy','namespace'=>"Modules\Buy\Http\\Controllers"],
function () {
    Route::resource('arr', 'ArrController');
});
 
//catego-route
Route::group(['middleware' => ['web','auth:admin'],'prefix'=>'buy','namespace'=>"Modules\Buy\Http\\Controllers"],
function () {
    Route::resource('catego', 'CategoController');
});

//good-route
Route::group(['middleware' => ['web','auth:admin'],'prefix'=>'buy','namespace'=>"Modules\Buy\Http\\Controllers"],
function () {
    Route::resource('good', 'GoodController');

});
 
//brand-route
Route::group(['middleware' => ['web','auth:admin'],'prefix'=>'buy','namespace'=>"Modules\Buy\Http\\Controllers"],
function () {
    Route::resource('brand', 'BrandController');
});


//为当前品牌异步获取所有的分类配路由，你想想，譬如你选择了三星，它究竟是那个分类是不是得获取
Route::get('/good/getbrandcate/{id}','Modules\Buy\Http\Controllers\GoodController@getbrandcate')->name('getbrandcate')->middleware(['web','auth:admin']);

//获取三级分类下面的可用属性
Route::get('/good/getattr/{id}','Modules\Buy\Http\Controllers\GoodController@getattr')->name('getattr')->middleware(['web','auth:admin']);


//huowu-route
Route::group(['middleware' => ['web','auth:admin'],'prefix'=>'buy','namespace'=>"Modules\Buy\Http\\Controllers"],
function () {
//    Route::resource('huowu', 'HuowuController');
//    货物首页路由
    Route::get('huowu/{good}', 'HuowuController@index');
//    添加货物路由
    Route::get('huowu/create/{good}', 'HuowuController@create');
//    表单提交的路由
    Route::post('huowu/{good}','HuowuController@store');
//    表单编辑的视图
    Route::get('huowu/edit/{good}/{huowu}','HuowuController@edit');
//    配置货物更新路由
    Route::put('huowu/{huowu}','HuowuController@update');
//    表单删除路由
    Route::delete('huowu/{huowu}','HuowuController@del');

});
 
//dingdan-route
Route::group(['middleware' => ['web','auth:admin'],'prefix'=>'buy','namespace'=>"Modules\Buy\Http\\Controllers"],
function () {
//    Route::resource('dingdan', 'DingdanController');

//    订单列表首页
    Route::any('/dingdan','DingdanController@index');
//    订单详情页
    Route::get('/more/{orderId}','DingdanController@more')->name('more');
//    后台状态变为2
    Route::any('/fahuo/{orderId}','DingdanController@fahuo');

});
//后台守卫拦截
Route::any('/fahuo/{orderId}','Modules\Buy\Http\Controllers\DingdanController@fahuo');
